package com.shiro.demo.project.system.login.domain;

import lombok.Data;
import lombok.NonNull;

import java.util.Collection;

@Data
public class User {
    private String username;
    private String password;
    private String password2;
    private String salt;
    private Collection<Role> roles;

    public User(){ }
    public User(@NonNull String username,@NonNull String password,@NonNull Collection<Role> roles){
        this.username = username;
        this.password = password;
        this.roles = roles;
        roles.forEach(role -> {
            role.setUsername(username);
        });
    }
}
